﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wentong300Cameral
{
    class GlobalVariable
    {
        public static string manualPlateNumber = "";

        public static string GetTimeStampMilliseconds()
        {
            // 获取当前的UTC时间
            DateTime currentTime = DateTime.UtcNow;

            // Unix纪元
            DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            // 计算当前时间与Unix纪元的时间间隔
            TimeSpan elapsedTime = currentTime - unixEpoch;

            // 获取总秒数
            //long totalSeconds = (long)elapsedTime.TotalSeconds;

            // 获取总毫秒数
            long totalMilliseconds = (long)elapsedTime.TotalMilliseconds;

            return totalMilliseconds.ToString();

        }

        public static string GetTimeStampSeconds()
        {
            // 获取当前的UTC时间
            DateTime currentTime = DateTime.UtcNow;

            // Unix纪元
            DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            // 计算当前时间与Unix纪元的时间间隔
            TimeSpan elapsedTime = currentTime - unixEpoch;

            // 获取总秒数
            long totalSeconds = (long)elapsedTime.TotalSeconds;

            return totalSeconds.ToString();

        }
    }
}
